from launch import LaunchDescription
from launch_ros.actions import LoadComposableNodes, Node
from launch_ros.descriptions import ComposableNode

def generate_launch_description():
    log_level = 'info'
    
    video_path = 'res/armor_video.mp4'

    return LaunchDescription([
        Node(
            package='rclcpp_components',
            executable='component_container',
            name='board_detection', 
            output='screen',
            ros_arguments=['--log-level', log_level]
        ),
        LoadComposableNodes(
            target_container='board_detection', 
            composable_node_descriptions=[
                ComposableNode(
                    package='board_detection',
                    plugin='palomino::BoardDetection',
                    name='board_detection_node',
                    extra_arguments=[{'use_intra_process_comms': True}],
                ),
                ComposableNode(
                    package='virtual_camera',
                    plugin='virtual_camera::CameraNode',
                    name='virtual_camera_node',
                    parameters=[
                        {'video_name': video_path}
                    ],
                    extra_arguments=[{'use_intra_process_comms': True}],
                ),
            ],
        ),
    ])